HAL RCC Functions

Oscillators, PSI, bus configurations, RCC and system clock reset functions

group RCC_Exported_Functions_Group1

This section provides functions allowing to configure the internal and external oscillators (HSE, HSIS, LSE, LSI, HSIDIV3, HSIK, PSIS, PSIDIV3, PSIK, HSIDIV18), CSS, MCO and the System buses clocks (SYSCLK, AHB, APB1, APB2 and APB3).

  • Internal/external clock and PSI configuration:

    • HSIS (High-Speed Internal System): 144 MHz factory-trimmed RC used as System clock source.

    • HSIDIV3 (High-Speed Internal Divided by 3): HSI clock divided by 3 (48 MHz) used for USB, RNG or as System clock source.

    • HSIK (High-Speed Internal Kernel Clock): Used for peripherals as kernel clock.

    • PSIS (Precise-Speed Internal System): PSIS configurable to several ranges used as System clock source.

    • PSIDIV3 (Precise-Speed Internal Divided by 3): PSI clock divided by 3 can be used for USB or RNG.

    • PSIK (Precise-Speed Internal Kernel Clock): Used for peripherals as kernel clock.

    • LSI (Low-Speed Internal): 32 kHz low consumption RC used as IWDG and/or RTC clock source. It can be selected by some peripherals as kernel clock.

    • HSE (High-Speed External): crystal or clock, from 4 to 50 MHz, used directly or through the PSI as System clock source. Can be used also optionally as RTC, USB, RNG or FDCAN clock source.

    • LSE (low-speed external): 32.768 kHz oscillator used optionally as RTC clock source. Used through the PSI as System clock source. Used for peripherals as kernel clock.

    • HSIDIV18 (High-Speed Internal Divided by 18): HSI clock divided by 18 (8 MHz). Used through the PSI as System clock source.

  • System, AHB and APB buses clocks configuration:

    • Several clock sources can be used to drive the System clock (SYSCLK): HSIS, HSI_DIV3 HSE and PSIS. The AHB clock (HCLK) is derived from System clock through configurable prescaler and used to clock the CPU, memory and peripherals mapped on AHB bus (DMA, GPIO…). APB1 (PCLK1), APB2 (PCLK2) and APB3 (PCLK3) clocks are derived from AHB clock through configurable prescalers and used to clock the peripherals mapped on these buses.

    • All the peripheral bus clocks are derived from the System clock (SYSCLK) except:

      • RTC: the RTC clock can be derived either from the LSI, LSE or HSE clock divided by 2 to 511.

      • USB Host and Device FS and RNG: USB Host and Device FS require a frequency equal to 48 MHz to work correctly, while RNG peripherals require a frequency equal or lower than to 48 MHz. This clock is derived of the PSIDIV3, HSIDIV3 or HSE

      • IWDG clock which is always the LSI clock.

      • DAC1 sample and hold clock. This clock is derived from LSI or LSE.

    • The maximum frequency of the SYSCLK, HCLK, PCLK1, PCLK2 and PCLK3 is 144 MHz. To correctly read data from Flash memory, the number of wait states (latency) must be correctly programmed in the FLASH register according to the frequency of the CPU clock (HCLK) and the internal voltage range of the device VCORE.

    When changing the CPU frequency, a software sequence must be applied in order to tune the number of wait states needed to access the flash memory:

    • FLASH latency must be increased before increasing the HCLK frequency

    • FLASH latency can be decreased only after decreasing the HCLK frequency

    The table below shows the correspondence between wait states and CPU clock frequency.

    Table 1. HCLK clock frequency for devices depending on FLASH latency and voltage range.

Latency

range 1

1.1V-1.2V

range 2

1.0V-1.1V

range 3

0.9 V-1.0V

range 4

0.9V

0WS(1 CPU cycle)

0 < HCLK <= 32

0 < HCLK <= 30

0 < HCLK <= 24

0 < HCLK <= 12

1WS(2 CPU cycles)

32 < HCLK <= 64

30 < HCLK <= 60

24 < HCLK <= 48

12 < HCLK <= 25

2WS(3 CPU cycles)

64 < HCLK <= 96

60 < HCLK <= 90

48 < HCLK <= 55

-

3WS(4 CPU cycles)

96 < HCLK <= 128

90 < HCLK <= 110

-

-

4WS(5 CPU cycles)

128 < HCLK <= 144

-

-

-

The table below shows the correspondence between wait states and CPU clock frequency.

Table 2. HCLK clock frequency for devices depending on FLASH latency and voltage range.

Latency

range 1/2/3

0.9V-1.2V

range 4

0.9V

0WS(1 CPU cycle)

0 < HCLK <= 8

1WS(2 CPU cycles)

WS >= HCLK (MHz) / 10 -1

8 < HCLK <= 16

2WS(3 CPU cycles)

Maximum HCLK

16 < HCLK <= 25

3WS(4 CPU cycles)

frequency is

-

given by Table 1

-

15WS(16 CPU cycles)

-

  • Reset functions:

    • Reset the RCC clock configuration to the default values (HSI at 48 MHz).

Functions to reset the RCC and system clock to default values.

Functions

void HAL_RCC_Reset ( void )

Reset the RCC clock configuration to the default reset state.

Note

SystemCoreClock and HAL timebase are updated in this function.

Note

Resources under backup domain reset if USE_HAL_RCC_RESET_RTC_DOMAIN set to 1U

Note

Peripherals clock enable and source selection reset if USE_HAL_RCC_RESET_PERIPH_CLOCK_MANAGEMENT set to 1U

Warning

Access to RTC domain must be enabled to disable RTC domain source clock.

hal_status_t HAL_RCC_ResetSystemClock ( void )

Reset the RCC clock configuration to the default system clock (HSIDIV3 at 48 MHz).

Note

SystemCoreClock and Systick are updated in this function.

Return values :
  • HAL_OK – System clock switched to HSIDIV3 (48MHz)

  • HAL_ERROR

    Timeout issue to enable the HSIDIV3 clock

    Switch to HSIDIV3 as source clock failed

    Issue to reconfigure the System tick

Functions to configure the different oscillators.

example: enable HSE oscillator

  • using atomic function (footprint optimisation):

    HAL_RCC_HSE_Enable(HAL_RCC_HSE_ON);
    

Note

The following functions configure and activate the different oscillators Configuration can be done:

  • using the atomic functions defined for each oscillators

    1. like HAL_RCC_{OSC}_Enable: {OSC} is HSIS/HSIDIV3/HSIK/LSI/LSE/HSE/PSIS/PSIDIV3/PSIK

Functions

hal_status_t HAL_RCC_HSI_EnableInStopMode ( void )

Enable the HSI oscillator in Stop mode.

Return values :

HAL_OK – HSI oscillator is forced ON even in Stop mode.

hal_status_t HAL_RCC_HSI_DisableInStopMode ( void )

Disable the HSI oscillator in Stop mode.

Return values :

HAL_OK – HSI oscillator is disabled in Stop mode.

hal_rcc_osc_stop_mode_status_t HAL_RCC_HSI_IsEnabledInStopMode ( void )

Check if HSI in stop mode is enabled.

Return values :
  • status – based on hal_rcc_osc_stop_mode_status_t

  • HAL_RCC_OSC_DISABLED_IN_STOP_MODE – HSI is disabled in stop mode

  • HAL_RCC_OSC_ENABLED_IN_STOP_MODE – HSI is enabled in stop mode

hal_status_t HAL_RCC_HSIS_Enable ( void )

Enable the HSIS clock for system.

Note

If HSI oscillator is disabled, enable it.

Return values :
  • HAL_OK – HSIS clock has been successfully activated

  • HAL_ERROR – Timeout linked to HSIS ready flag not set

hal_status_t HAL_RCC_HSIS_Disable ( void )

Disable the HSIS clock for system.

Note

If all other clocks of the HSI oscillator are disabled (HSIDIV3 and HSIK), disable the HSI oscillator.

Return values :
  • HAL_OK – HSIS clock has been successfully deactivated

  • HAL_ERROR

    HSIS clock is used as system clock

    HSIDIV18 clock is used as source clock of the PSI oscillator and PSI is used as system clock

    Timeout linked to HSIS ready flag not reset

hal_rcc_osc_enable_status_t HAL_RCC_HSIS_IsEnabled ( void )

Check if HSIS is enabled.

Return values :
  • status – based on hal_rcc_osc_enable_status_t

  • HAL_RCC_OSC_DISABLED – HSIS clock is disabled

  • HAL_RCC_OSC_ENABLED – HSIS clock is enabled

hal_rcc_osc_ready_status_t HAL_RCC_HSIS_IsReady ( void )

Check if HSIS is ready.

Return values :
  • status – based on hal_rcc_osc_ready_status_t

  • HAL_RCC_OSC_READY – HSIS is enabled and ready

  • HAL_RCC_OSC_NOT_READY – HSIS can be enabled but not ready

hal_status_t HAL_RCC_HSIDIV3_Enable ( void )

Enable the HSIDIV3 clock for system or for peripheral clock source.

Note

If HSI oscillator is disabled, enable it.

Return values :
  • HAL_OK – HSIDIV3 clock has been successfully activated

  • HAL_ERROR – Timeout linked to HSIDIV3 ready flag not set

hal_status_t HAL_RCC_HSIDIV3_Disable ( void )

Disable the HSIDIV3 clock.

Note

If all other clocks of the HSI oscillator are disabled (HSIS and HSIK), disable the HSI oscillator.

Warning

This HSIDIV3 clock might be used as peripheral clock source and this function will stop any peripherals using it.

Return values :
  • HAL_OK – HSIDIV3 clock has been successfully deactivated

  • HAL_ERROR

    HSIDIV3 clock is used as system clock

    Timeout linked to HSIDIV3 ready flag not reset

hal_rcc_osc_enable_status_t HAL_RCC_HSIDIV3_IsEnabled ( void )

Check if HSIDIV3 is enabled.

Return values :
  • status – based on hal_rcc_osc_enable_status_t

  • HAL_RCC_OSC_DISABLED – HSIDIV3 clock is disabled

  • HAL_RCC_OSC_ENABLED – HSIDIV3 clock is enabled

hal_rcc_osc_ready_status_t HAL_RCC_HSIDIV3_IsReady ( void )

Check if HSIDIV3 is ready.

Return values :
  • status – based on hal_rcc_osc_ready_status_t

  • HAL_RCC_OSC_READY – HSIDIV3 is enabled and ready

  • HAL_RCC_OSC_NOT_READY – HSIDIV3 can be enabled but not ready

hal_status_t HAL_RCC_HSIK_Enable ( hal_rcc_hsik_div_t divider )

Enable the HSIK clock.

Note

If HSI oscillator is disabled, enable it.

Parameters :

divider – Prescaler value

Return values :
  • HAL_OK – HSIK clock has been activated successfully

  • HAL_ERROR – Timeout linked to HSIK ready flag not set

hal_status_t HAL_RCC_HSIK_Disable ( void )

Disable the HSIK clock.

Note

If all other clocks of the HSI oscillator are disabled (HSIS and HSIDIV3), disable the HSI oscillator.

Warning

This HSIK clock might be used as peripheral clock source and this function will stop any peripherals using it.

Return values :

HAL_OK – HSIK clock has been successfully deactivated HAL_ERROR Timeout linked to HSIK ready flag not reset

hal_rcc_osc_enable_status_t HAL_RCC_HSIK_IsEnabled ( void )

Check if HSIK is enabled.

Return values :
  • status – based on hal_rcc_osc_enable_status_t

  • HAL_RCC_OSC_DISABLED – HSIK clock is disabled

  • HAL_RCC_OSC_ENABLED – HSIK clock is enabled

hal_rcc_osc_ready_status_t HAL_RCC_HSIK_IsReady ( void )

Check if HSIK is ready.

Return values :
  • status – based on hal_rcc_osc_ready_status_t

  • HAL_RCC_OSC_READY – HSIK is enabled and ready

  • HAL_RCC_OSC_NOT_READY – HSIK can be enabled but not ready

hal_rcc_hsik_div_t HAL_RCC_HSIK_GetDivider ( void )

Get HSIK prescaler value.

Return values :

value – based on hal_rcc_hsik_div_t

hal_status_t HAL_RCC_LSI_Enable ( void )

Enable the Internal Low Speed oscillator (LSI).

Return values :
  • HAL_OK – LSI oscillator has been configured successfully

  • HAL_ERROR – Timeout linked to LSI ready flag not set

hal_status_t HAL_RCC_LSI_Disable ( void )

Disable the LSI oscillator.

Warning

This oscillator might be used as peripheral clock source and this function will stop any peripherals using it.

Return values :
  • HAL_OK – LSI oscillator has been deactivated successfully

  • HAL_ERROR – Timeout linked to LSI ready flag not reset

hal_rcc_osc_enable_status_t HAL_RCC_LSI_IsEnabled ( void )

Check if LSI is enabled.

Return values :
  • status – based on hal_rcc_osc_enable_status_t

  • HAL_RCC_OSC_DISABLED – LSI clock is disabled

  • HAL_RCC_OSC_ENABLED – LSI clock is enabled

hal_rcc_osc_ready_status_t HAL_RCC_LSI_IsReady ( void )

Check if LSI is ready.

Return values :
  • status – based on hal_rcc_osc_ready_status_t

  • HAL_RCC_OSC_READY – LSI is enabled and ready

  • HAL_RCC_OSC_NOT_READY – LSI can be enabled but not ready

hal_status_t HAL_RCC_PSI_EnableInStopMode ( void )

Enable the PSI oscillator in Stop mode.

Return values :

HAL_OK – PSI oscillator is forced ON even in Stop mode.

hal_status_t HAL_RCC_PSI_DisableInStopMode ( void )

Disable the PSI oscillator in Stop mode.

Return values :

HAL_OK – PSI oscillator is disabled in Stop mode.

hal_rcc_osc_stop_mode_status_t HAL_RCC_PSI_IsEnabledInStopMode ( void )

Check if PSI in stop mode is enabled.

Return values :
  • status – based on hal_rcc_osc_stop_mode_status_t

  • HAL_RCC_OSC_DISABLED_IN_STOP_MODE – PSI is disabled in stop mode

  • HAL_RCC_OSC_ENABLED_IN_STOP_MODE – PSI is enabled in stop mode

hal_status_t HAL_RCC_PSIS_Enable ( void )

Enable the PSIS clock for system.

Note

If PSI oscillator is disabled, enable it.

Return values :
  • HAL_OK – PSIS clock has been activated successfully

  • HAL_ERROR – Timeout linked to PSIS ready flag not set

hal_status_t HAL_RCC_PSIS_Disable ( void )

Disable the PSIS clock for system.

Note

If all other clocks of the PSI oscillator are disabled (PSIK and PSIDIV3), disable the PSI oscillator.

Return values :
  • HAL_OK – PSIS clock has been deactivated successfully

  • HAL_ERROR

    PSIS clock is used as system clock

    Timeout linked to PSIS ready flag not reset

hal_rcc_osc_enable_status_t HAL_RCC_PSIS_IsEnabled ( void )

Check if PSIS is enabled.

Return values :
  • status – based on hal_rcc_osc_enable_status_t

  • HAL_RCC_OSC_DISABLED – PSIS clock is disabled

  • HAL_RCC_OSC_ENABLED – PSIS clock is enabled

hal_rcc_osc_ready_status_t HAL_RCC_PSIS_IsReady ( void )

Check if PSIS is ready.

Return values :
  • status – based on hal_rcc_osc_ready_status_t

  • HAL_RCC_OSC_READY – PSIS is enabled and ready

  • HAL_RCC_OSC_NOT_READY – PSIS can be enabled but not ready

hal_status_t HAL_RCC_PSIDIV3_Enable ( void )

Enable the PSIDIV3 clock for system or for peripheral clock source.

Note

If PSI oscillator is disabled, enable it.

Return values :
  • HAL_OK – PSIDIV3 clock has been activated successfully

  • HAL_ERROR – Timeout linked to PSIDIV3 ready flag not set

hal_status_t HAL_RCC_PSIDIV3_Disable ( void )

Disable the PSIDIV3 clock for system or for peripheral clock source.

Note

If all other clocks of the PSI oscillator are disabled (PSIK and PSIS), disable the PSI oscillator.

Warning

This PSIDIV3 clock might be used as peripheral clock source and this function will stop any peripheral functions.

Return values :

HAL_OK – PSIDIV3 clock has been deactivated successfully HAL_ERROR Timeout linked to PSIDIV3 ready flag not reset

hal_rcc_osc_enable_status_t HAL_RCC_PSIDIV3_IsEnabled ( void )

Check if PSIDIV3 is enabled.

Return values :
  • status – based on hal_rcc_osc_enable_status_t

  • HAL_RCC_OSC_DISABLED – PSIDIV3 clock is disabled

  • HAL_RCC_OSC_ENABLED – PSIDIV3 clock is enabled

hal_rcc_osc_ready_status_t HAL_RCC_PSIDIV3_IsReady ( void )

Check if PSIDIV3 is ready.

Return values :
  • status – based on hal_rcc_osc_ready_status_t

  • HAL_RCC_OSC_READY – PSIDIV3 is enabled and ready

  • HAL_RCC_OSC_NOT_READY – PSIDIV3 can be enabled but not ready

hal_status_t HAL_RCC_PSIK_Enable ( hal_rcc_psik_div_t divider )

Enable the PSIK clock for peripheral clock source.

Note

If PSI oscillator is disabled, enable it.

Parameters :

divider – Prescaler value

Return values :
  • HAL_OK – PSIK clock has been activated successfully

  • HAL_ERROR – Timeout linked to PSIK ready flag not set

hal_status_t HAL_RCC_PSIK_Disable ( void )

Disable the PSIK clock for peripheral clock source.

Note

If all other clocks of the PSI oscillator are disabled (PSIS and PSIDIV3), disable the PSI oscillator.

Warning

This PSIK clock might be used as peripheral clock source and this function will stop any peripheral functions.

Return values :

HAL_OK – PSIK clock has been deactivated successfully HAL_ERROR Timeout linked to PSIK ready flag not reset

hal_rcc_osc_enable_status_t HAL_RCC_PSIK_IsEnabled ( void )

Check if PSIK is enabled.

Return values :
  • status – based on hal_rcc_osc_enable_status_t

  • HAL_RCC_OSC_DISABLED – PSIK clock is disabled

  • HAL_RCC_OSC_ENABLED – PSIK clock is enabled

hal_rcc_osc_ready_status_t HAL_RCC_PSIK_IsReady ( void )

Check if PSIK is ready.

Return values :
  • status – based on hal_rcc_osc_ready_status_t

  • HAL_RCC_OSC_READY – PSIK is enabled and ready

  • HAL_RCC_OSC_NOT_READY – PSIK can be enabled but not ready

hal_rcc_psik_div_t HAL_RCC_PSIK_GetDivider ( void )

Get PSIK prescaler value.

Return values :

value – based on hal_rcc_psik_div_t

hal_status_t HAL_RCC_PSI_SetConfig ( const hal_rcc_psi_config_t * p_config )

Configure PSI oscillator without enabling outputs clock.

The config function will perform the following actions:

  • Check in PSI is well deactivated (if enabled exit from this function)

  • Configure the PSI with full list of parameters

Note

Ensure a valid configuration. See PSI section on RCC chapter of the RM.

Parameters :

p_config – pointer to a hal_rcc_psi_config_t structure that contains the configuration information for the PSI

Return values :
  • HAL_OK – PSI has been correctly configured

  • HAL_INVALID_PARAM – Input parameter not valid (USE_HAL_CHECK_PARAM enabled)

  • HAL_ERROR – PSI is already enabled and cannot be modified.

void HAL_RCC_PSI_GetConfig ( hal_rcc_psi_config_t * p_config )

Return the configuration of PSI.

Parameters :

p_config – pointer to a hal_rcc_psi_config_t structure that contains the configuration information for the PSI

Functions to configure the bus prescalers and retrieve bus clock frequencies (SYSCLK, HCLK and PCLKx).

Note

Unitary functions can be used to configure independently each bus.

      example: all the BUS prescalers are set

      - Call the global @ref HAL_RCC_SetBusClockConfig
        @code
          LL_FLASH_SetLatency(FLASH1, LL_FLASH_LATENCY_4WS);
          HAL_RCC_SetSYSCLKSource(HAL_RCC_SYSCLK_SRC_PLLCLK);
          hal_rcc_bus_clk_config_t config_bus;
          config_bus.hclk_prescaler  = HAL_RCC_HCLK_PRESCALER1;
          config_bus.pclk1_prescaler = HAL_RCC_PCLK_PRESCALER1;
          config_bus.pclk2_prescaler = HAL_RCC_PCLK_PRESCALER1;
          config_bus.pclk3_prescaler = HAL_RCC_PCLK_PRESCALER1;
          HAL_RCC_SetBusClockConfig(&config_bus);
        @endcode

Functions

hal_status_t HAL_RCC_SetSYSCLKSource ( hal_rcc_sysclk_src_t source )

Set the CPU bus clock source (SYSCLK).

Note

Ensure that the clock source is ready.

Note

When running from Flash, ensure that the number of flash wait states is correct for the selected HCLK frequency.

Parameters :

source – System clock source based on hal_rcc_sysclk_src_t

Return values :
  • HAL_OK – Success

  • HAL_ERROR

    System clock source has not been applied

    HSIS not enabled to switch to HSIS as system clock

    HSIDIV3 not enabled to switch to HSIDIV3 as system clock

    HSE not enabled to switch to HSE as system clock

    PSIS not enabled to switch to PSIS as system clock

hal_rcc_sysclk_src_t HAL_RCC_GetSYSCLKSource ( void )

Get the system clock source (SYSCLK).

Return values :

hal_rcc_sysclk_src_t – System Clock source

void HAL_RCC_SetSysTickExternalClkSource ( hal_rcc_systick_clk_src_t clk_src )

Set the Systick external clock source.

Parameters :

clk_src – Systick external clock source selection based on hal_rcc_systick_clk_src_t

hal_rcc_systick_clk_src_t HAL_RCC_GetSysTickExternalClkSource ( void )

Get the Systick external clock source.

Return values :

Systick – external clock source based on hal_rcc_systick_clk_src_t

void HAL_RCC_SetHCLKPrescaler ( hal_rcc_hclk_prescaler_t prescaler )

Set the HCLK (AHB clock) prescaler.

Parameters :

prescaler – Prescaler value

void HAL_RCC_SetPCLK1Prescaler ( hal_rcc_pclk_prescaler_t prescaler )

Set the PCLK1 (APB1 clock) prescaler.

Parameters :

prescaler – Prescaler value

void HAL_RCC_SetPCLK2Prescaler ( hal_rcc_pclk_prescaler_t prescaler )

Set the PCLK2 (APB2 clock) prescaler.

Parameters :

prescaler – Prescaler value

void HAL_RCC_SetPCLK3Prescaler ( hal_rcc_pclk_prescaler_t prescaler )

Set the PCLK3 (APB3 clock) prescaler.

Parameters :

prescaler – Prescaler value

hal_rcc_hclk_prescaler_t HAL_RCC_GetHCLKPrescaler ( void )

Get the AHB bus clock prescaler (HCLK).

Return values :

hal_rcc_hclk_prescaler_t – Prescaler value

hal_rcc_pclk_prescaler_t HAL_RCC_GetPCLK1Prescaler ( void )

Set the APB1 bus clock prescaler (PCLK1).

Return values :

hal_rcc_pclk_prescaler_t – Prescaler value

hal_rcc_pclk_prescaler_t HAL_RCC_GetPCLK2Prescaler ( void )

Set the APB2 bus clock prescaler (PCLK2).

Return values :

hal_rcc_pclk_prescaler_t – Prescaler value

hal_rcc_pclk_prescaler_t HAL_RCC_GetPCLK3Prescaler ( void )

Set the APB3 bus clock prescaler (PCLK3).

Return values :

hal_rcc_pclk_prescaler_t – Prescaler value

hal_status_t HAL_RCC_SetBusClockConfig ( const hal_rcc_bus_clk_config_t * p_config )

Configure the bus dividers.

Warning

FLASH latency must be adjusted according to the targeted system clock frequency and voltage scaling.

Parameters :

p_config – Pointer based on hal_rcc_bus_clk_config_t structure

Return values :
  • HAL_OK – Success

  • HAL_INVALID_PARAM – Input parameter not valid (USE_HAL_CHECK_PARAM enabled)

void HAL_RCC_GetBusClockConfig ( hal_rcc_bus_clk_config_t * p_config )

Retrieve the bus dividers.

Parameters :

p_config – Pointer on hal_rcc_bus_clk_config_t structure

uint32_t HAL_RCC_GetPSIClockFreq ( void )

Return the PSI output frequency.

Note

The PSI frequency computed by this function is not the real frequency in the chip. It is calculated based on the predefined constant and the selected clock source.

Note

If PSI source is HSIDIV3, function returns values based on HSI_VALUE.

Note

If PSI source is HSE, function returns values based on HSE_VALUE.

Note

If PSI source is LSE, function returns values based on LSE.

Return values :

uint32_t – PSICLK frequency in Hz

uint32_t HAL_RCC_GetSYSCLKFreq ( void )

Return the SYSCLK frequency.

Note

The system frequency computed by this function is not the real frequency in the chip. It is calculated based on the predefined constant and the selected clock source.

Note

If SYSCLK source is HSIS or HSIDIV3, function returns values based on HSI_VALUE.

Note

If SYSCLK source is HSE, function returns values based on HSE_VALUE.

Note

If SYSCLK source is PSI, function returns values based on HSE_VALUE, LSE_VALUE or HSI_VALUE

Note

This function can be used by the user application to compute the baudrate for the communication peripherals or configure other parameters.

Warning

Each time SYSCLK changes, this function must be called to update the right SYSCLK value. Otherwise, any configuration based on this function will be incorrect.

Return values :

uint32_t – SYSCLK frequency in Hz

uint32_t HAL_RCC_GetHCLKFreq ( void )

Return the HCLK frequency.

Warning

Each time HCLK changes, this function must be called to update the right HCLK value. Otherwise, any configuration based on this function will be incorrect.

Return values :

uint32_t – HCLK frequency in Hz

uint32_t HAL_RCC_GetPCLK1Freq ( void )

Return the PCLK1 frequency.

Warning

Each time PCLK1 changes, this function must be called to update the right PCLK1 value. Otherwise, any configuration based on this function will be incorrect.

Return values :

uint32_t – PCLK1 frequency in Hz

uint32_t HAL_RCC_GetPCLK2Freq ( void )

Return the PCLK2 frequency.

Warning

Each time PCLK2 changes, this function must be called to update the right PCLK2 value. Otherwise, any configuration based on this function will be incorrect.

Return values :

uint32_t – PCLK2 frequency in Hz

uint32_t HAL_RCC_GetPCLK3Freq ( void )

Return the PCLK3 frequency.

Warning

Each time PCLK3 changes, this function must be called to update the right PCLK3 value. Otherwise, any configuration based on this function will be incorrect.

Return values :

uint32_t – PCLK3 frequency in Hz

Functions to Set, Get the Systick external clock source and frequency.

Functions

void HAL_RCC_SetSysTickExternalClkSource ( hal_rcc_systick_clk_src_t clk_src )

Set the Systick external clock source.

Parameters :

clk_src – Systick external clock source selection based on hal_rcc_systick_clk_src_t

hal_rcc_systick_clk_src_t HAL_RCC_GetSysTickExternalClkSource ( void )

Get the Systick external clock source.

Return values :

Systick – external clock source based on hal_rcc_systick_clk_src_t

uint32_t HAL_RCC_GetSysTickExternalClkFreq ( void )

Get the Systick external clock frequency.

Return values :

uint32_t – Frequency in Hz

Peripheral Clock management on buses

group RCC_Exported_Functions_Group2

This subsection provides a set of functions (on AHB1, AHB2, AHB4, APB1, APB2 or APB3 buses) allowing to:

  • Enable or disable the peripherals clock.

  • Reset of peripherals clock.

  • Enable or disable the peripherals clock in low power mode.

Enable or disable the Bus peripheral clocks.

Functions

void HAL_RCC_AHB1_EnableBusClock ( void )

This function enables the AHB1 Bus clock.

hal_rcc_clk_status_t HAL_RCC_AHB1_IsEnabledBusClock ( void )

This function checks if AHB1 bus clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – AHB1 bus clock is disabled

  • HAL_RCC_CLK_ENABLED – AHB1 bus clock is enabled

void HAL_RCC_AHB1_DisableBusClock ( void )

This function disables the AHB1 Bus clock.

void HAL_RCC_AHB2_EnableBusClock ( void )

This function enables the AHB2 Bus clock.

hal_rcc_clk_status_t HAL_RCC_AHB2_IsEnabledBusClock ( void )

This function checks if AHB2 bus clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – AHB2 bus clock is disabled

  • HAL_RCC_CLK_ENABLED – AHB2 bus clock is enabled

void HAL_RCC_AHB2_DisableBusClock ( void )

This function disables the AHB2 Bus clock.

void HAL_RCC_APB1_EnableBusClock ( void )

This function enables the APB1 Bus clock.

hal_rcc_clk_status_t HAL_RCC_APB1_IsEnabledBusClock ( void )

This function checks if APB1 bus clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – APB1 bus clock is disabled

  • HAL_RCC_CLK_ENABLED – APB1 bus clock is enabled

void HAL_RCC_APB1_DisableBusClock ( void )

This function disables the APB1 Bus clock.

void HAL_RCC_APB2_EnableBusClock ( void )

This function enables the APB2 Bus clock.

hal_rcc_clk_status_t HAL_RCC_APB2_IsEnabledBusClock ( void )

This function checks if APB2 bus clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – APB2 bus clock is disabled

  • HAL_RCC_CLK_ENABLED – APB2 bus clock is enabled

void HAL_RCC_APB2_DisableBusClock ( void )

This function disables the APB2 Bus clock.

void HAL_RCC_APB3_EnableBusClock ( void )

This function enables the APB3 Bus clock.

hal_rcc_clk_status_t HAL_RCC_APB3_IsEnabledBusClock ( void )

This function checks if APB3 bus clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – APB3 bus clock is disabled

  • HAL_RCC_CLK_ENABLED – APB3 bus clock is enabled

void HAL_RCC_APB3_DisableBusClock ( void )

This function disables the APB3 Bus clock.

Enable or disable the AHB1 peripheral clock.

Note

After reset, the peripheral clock (used for registers read/write access) is disabled and the application software has to enable this clock before using it excepted for FLASH and SRAMx.

Functions

void HAL_RCC_LPDMA1_EnableClock ( void )

This function enables the LPDMA1 clock.

void HAL_RCC_LPDMA2_EnableClock ( void )

This function enables the LPDMA2 clock.

void HAL_RCC_FLASH_EnableClock ( void )

This function enables the FLASH clock.

void HAL_RCC_CRC_EnableClock ( void )

This function enables the CRC clock.

void HAL_RCC_CORDIC_EnableClock ( void )

This function enables the CORDIC clock.

void HAL_RCC_RAMCFG_EnableClock ( void )

This function enables the RAMCFG clock.

void HAL_RCC_SRAM1_EnableClock ( void )

This function enables the SRAM1 clock.

void HAL_RCC_SRAM2_EnableClock ( void )

This function enables the SRAM1 clock.

void HAL_RCC_LPDMA1_DisableClock ( void )

This function disables the LPDMA1 clock.

void HAL_RCC_LPDMA2_DisableClock ( void )

This function disables the LPDMA2 clock.

void HAL_RCC_FLASH_DisableClock ( void )

This function disables the FLASH clock.

void HAL_RCC_CRC_DisableClock ( void )

This function disables the CRC clock.

void HAL_RCC_CORDIC_DisableClock ( void )

This function disables the CORDIC clock.

void HAL_RCC_RAMCFG_DisableClock ( void )

This function disables the RAMCFG clock.

void HAL_RCC_SRAM1_DisableClock ( void )

This function disables the SRAM1 clock.

void HAL_RCC_SRAM2_DisableClock ( void )

This function disables the SRAM2 clock.

Enable or disable the AHB2 peripheral clock.

Note

After reset, the peripheral clock (used for registers read/write access) is disabled and the application software has to enable this clock before using it.

Functions

void HAL_RCC_GPIOA_EnableClock ( void )

This function enables the GPIOA clock.

void HAL_RCC_GPIOB_EnableClock ( void )

This function enables the GPIOB clock.

void HAL_RCC_GPIOC_EnableClock ( void )

This function enables the GPIOC clock.

void HAL_RCC_GPIOD_EnableClock ( void )

This function enables the GPIOD clock.

void HAL_RCC_GPIOE_EnableClock ( void )

This function enables the GPIOE clock.

void HAL_RCC_GPIOH_EnableClock ( void )

This function enables the GPIOH clock.

void HAL_RCC_ADC12_EnableClock ( void )

This function enables the ADC12 clock.

void HAL_RCC_DAC1_EnableClock ( void )

This function enables the DAC1 clock.

void HAL_RCC_AES_EnableClock ( void )

This function enables the AES clock.

void HAL_RCC_HASH_EnableClock ( void )

This function enables the HASH clock.

void HAL_RCC_RNG_EnableClock ( void )

This function enables the RNG clock.

void HAL_RCC_GPIOA_DisableClock ( void )

This function disables the GPIOA clock.

void HAL_RCC_GPIOB_DisableClock ( void )

This function disables the GPIOB clock.

void HAL_RCC_GPIOC_DisableClock ( void )

This function disables the GPIOC clock.

void HAL_RCC_GPIOD_DisableClock ( void )

This function disables the GPIOD clock.

void HAL_RCC_GPIOE_DisableClock ( void )

This function disables the GPIOE clock.

void HAL_RCC_GPIOH_DisableClock ( void )

This function disables the GPIOH clock.

void HAL_RCC_ADC12_DisableClock ( void )

This function disables the ADC12 clock.

void HAL_RCC_DAC1_DisableClock ( void )

This function disables the DAC1 clock.

void HAL_RCC_AES_DisableClock ( void )

This function disables the AES clock.

void HAL_RCC_HASH_DisableClock ( void )

This function disables the HASH clock.

void HAL_RCC_RNG_DisableClock ( void )

This function disables the RNG clock.

Enable or disable the APB1 peripheral clock.

Note

After reset, the peripheral clock (used for registers read/write access) is disabled and the application software has to enable this clock before using it.

Functions

void HAL_RCC_TIM2_EnableClock ( void )

This function enables the TIM2 clock.

void HAL_RCC_TIM5_EnableClock ( void )

This function enables the TIM5 clock.

void HAL_RCC_TIM6_EnableClock ( void )

This function enables the TIM6 clock.

void HAL_RCC_TIM7_EnableClock ( void )

This function enables the TIM7 clock.

void HAL_RCC_TIM12_EnableClock ( void )

This function enables the TIM12 clock.

void HAL_RCC_WWDG_EnableClock ( void )

This function enables the WWDG clock.

void HAL_RCC_SPI2_EnableClock ( void )

This function enables the SPI2 clock.

void HAL_RCC_SPI3_EnableClock ( void )

This function enables the SPI3 clock.

void HAL_RCC_USART2_EnableClock ( void )

This function enables the USART2 clock.

void HAL_RCC_USART3_EnableClock ( void )

This function enables the USART3 clock.

void HAL_RCC_UART4_EnableClock ( void )

This function enables the UART4 clock.

void HAL_RCC_UART5_EnableClock ( void )

This function enables the UART5 clock.

void HAL_RCC_I2C1_EnableClock ( void )

This function enables the I2C1 clock.

void HAL_RCC_I2C2_EnableClock ( void )

This function enables the I2C2 clock.

void HAL_RCC_I3C1_EnableClock ( void )

This function enables the I3C1 clock.

void HAL_RCC_CRS_EnableClock ( void )

This function enables the CRS clock.

void HAL_RCC_COMP12_EnableClock ( void )

This function enables the COMP12 clock.

Note

COMP2 not defined in all devices.

void HAL_RCC_FDCAN_EnableClock ( void )

This function enables the FDCAN clock.

Note

The FDCAN clock is common for all FDCAN instances

void HAL_RCC_TIM2_DisableClock ( void )

This function disables the TIM2 clock.

void HAL_RCC_TIM5_DisableClock ( void )

This function disables the TIM5 clock.

void HAL_RCC_TIM6_DisableClock ( void )

This function disables the TIM6 clock.

void HAL_RCC_TIM7_DisableClock ( void )

This function disables the TIM7 clock.

void HAL_RCC_TIM12_DisableClock ( void )

This function disables the TIM12 clock.

void HAL_RCC_SPI2_DisableClock ( void )

This function disables the SPI2 clock.

void HAL_RCC_SPI3_DisableClock ( void )

This function disables the SPI3 clock.

void HAL_RCC_USART2_DisableClock ( void )

This function disables the USART2 clock.

void HAL_RCC_USART3_DisableClock ( void )

This function disables the USART3 clock.

void HAL_RCC_UART4_DisableClock ( void )

This function disables the UART4 clock.

void HAL_RCC_UART5_DisableClock ( void )

This function disables the UART5 clock.

void HAL_RCC_I2C1_DisableClock ( void )

This function disables the I2C1 clock.

void HAL_RCC_I2C2_DisableClock ( void )

This function disables the I2C2 clock.

void HAL_RCC_I3C1_DisableClock ( void )

This function disables the I3C1 clock.

void HAL_RCC_CRS_DisableClock ( void )

This function disables the CRS clock.

void HAL_RCC_COMP12_DisableClock ( void )

This function disables the COMP12 clock.

Note

COMP2 not defined in all devices.

void HAL_RCC_FDCAN_DisableClock ( void )

This function disables the FDCAN clock.

Note

The FDCAN clock is common for all FDCAN instances

Enable or disable the APB2 peripheral clock.

Note

After reset, the peripheral clock (used for registers read/write access) is disabled and the application software has to enable this clock before using it.

Functions

void HAL_RCC_TIM1_EnableClock ( void )

This function enables the TIM1 clock.

void HAL_RCC_SPI1_EnableClock ( void )

This function enables the SPI1 clock.

void HAL_RCC_TIM8_EnableClock ( void )

This function enables the TIM8 clock.

void HAL_RCC_USART1_EnableClock ( void )

This function enables the USART1 clock.

void HAL_RCC_TIM15_EnableClock ( void )

This function enables the TIM15 clock.

void HAL_RCC_TIM16_EnableClock ( void )

This function enables the TIM16 clock.

void HAL_RCC_TIM17_EnableClock ( void )

This function enables the TIM17 clock.

void HAL_RCC_USB_EnableClock ( void )

This function enables the USB clock.

void HAL_RCC_TIM1_DisableClock ( void )

This function disables the TIM1 clock.

void HAL_RCC_SPI1_DisableClock ( void )

This function disables the SPI1 clock.

void HAL_RCC_TIM8_DisableClock ( void )

This function disables the TIM8 clock.

void HAL_RCC_USART1_DisableClock ( void )

This function disables the USART1 clock.

void HAL_RCC_TIM15_DisableClock ( void )

This function disables the TIM15 clock.

void HAL_RCC_TIM16_DisableClock ( void )

This function disables the TIM16 clock.

void HAL_RCC_TIM17_DisableClock ( void )

This function disables the TIM17 clock.

void HAL_RCC_USB_DisableClock ( void )

This function disables the USB clock.

Enable or disable the APB3 peripheral clock.

Note

After reset, the peripheral clock (used for registers read/write access) is disabled and the application software has to enable this clock before using it.

Functions

void HAL_RCC_SBS_EnableClock ( void )

This function enables the SBS clock.

void HAL_RCC_LPUART1_EnableClock ( void )

This function enables the LPUART1 clock.

void HAL_RCC_LPTIM1_EnableClock ( void )

This function enables the LPTIM1 clock.

void HAL_RCC_RTCAPB_EnableClock ( void )

This function enables the RTCAPB clock.

void HAL_RCC_SBS_DisableClock ( void )

This function disables the SBS clock.

void HAL_RCC_LPUART1_DisableClock ( void )

This function disables the LPUART1 clock.

void HAL_RCC_LPTIM1_DisableClock ( void )

This function disables the LPTIM1 clock.

void HAL_RCC_RTCAPB_DisableClock ( void )

This function disables the RTCAPB clock.

Check whether the AHB1 peripheral clock is enabled or not.

Note

After reset, the peripheral clock (used for registers read/write access) is disabled and the application software has to enable this clock before using it.

Functions

hal_rcc_clk_status_t HAL_RCC_LPDMA1_IsEnabledClock ( void )

This function checks if the LPDMA1 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – LPDMA1 clock is disabled

  • HAL_RCC_CLK_ENABLED – LPDMA1 clock is enabled

hal_rcc_clk_status_t HAL_RCC_LPDMA2_IsEnabledClock ( void )

This function checks if the LPDMA2 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – LPDMA2 clock is disabled

  • HAL_RCC_CLK_ENABLED – LPDMA2 clock is enabled

hal_rcc_clk_status_t HAL_RCC_FLASH_IsEnabledClock ( void )

This function checks if the FLASH clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – FLASH clock is disabled

  • HAL_RCC_CLK_ENABLED – FLASH clock is enabled

hal_rcc_clk_status_t HAL_RCC_CRC_IsEnabledClock ( void )

This function checks if the CRC clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – CRC clock is disabled

  • HAL_RCC_CLK_ENABLED – CRC clock is enabled

hal_rcc_clk_status_t HAL_RCC_CORDIC_IsEnabledClock ( void )

This function checks if the CORDIC clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – CORDIC clock is disabled

  • HAL_RCC_CLK_ENABLED – CORDIC clock is enabled

hal_rcc_clk_status_t HAL_RCC_RAMCFG_IsEnabledClock ( void )

This function checks if the RAMCFG clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – RAMCFG clock is disabled

  • HAL_RCC_CLK_ENABLED – RAMCFG clock is enabled

hal_rcc_clk_status_t HAL_RCC_SRAM1_IsEnabledClock ( void )

This function checks if the SRAM1 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – SRAM1 clock is disabled

  • HAL_RCC_CLK_ENABLED – SRAM1 clock is enabled

hal_rcc_clk_status_t HAL_RCC_SRAM2_IsEnabledClock ( void )

This function checks if the SRAM2 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – SRAM2 clock is disabled

  • HAL_RCC_CLK_ENABLED – SRAM2 clock is enabled

Check whether the AHB2 peripheral clock is enabled or not.

Note

After reset, the peripheral clock (used for registers read/write access) is disabled and the application software has to enable this clock before using it.

Functions

hal_rcc_clk_status_t HAL_RCC_GPIOA_IsEnabledClock ( void )

This function checks if the GPIOA clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – GPIOA clock is disabled

  • HAL_RCC_CLK_ENABLED – GPIOA clock is enabled

hal_rcc_clk_status_t HAL_RCC_GPIOB_IsEnabledClock ( void )

This function checks if the GPIOB clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – GPIOB clock is disabled

  • HAL_RCC_CLK_ENABLED – GPIOB clock is enabled

hal_rcc_clk_status_t HAL_RCC_GPIOC_IsEnabledClock ( void )

This function checks if the GPIOC clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – GPIOC clock is disabled

  • HAL_RCC_CLK_ENABLED – GPIOC clock is enabled

hal_rcc_clk_status_t HAL_RCC_GPIOD_IsEnabledClock ( void )

This function checks if the GPIOD clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – GPIOD clock is disabled

  • HAL_RCC_CLK_ENABLED – GPIOD clock is enabled

hal_rcc_clk_status_t HAL_RCC_GPIOE_IsEnabledClock ( void )

This function checks if the GPIOE clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – GPIOE clock is disabled

  • HAL_RCC_CLK_ENABLED – GPIOE clock is enabled

hal_rcc_clk_status_t HAL_RCC_GPIOH_IsEnabledClock ( void )

This function checks if the GPIOH clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – GPIOH clock is disabled

  • HAL_RCC_CLK_ENABLED – GPIOH clock is enabled

hal_rcc_clk_status_t HAL_RCC_ADC12_IsEnabledClock ( void )

This function checks if the ADC12 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – ADC12 clock is disabled

  • HAL_RCC_CLK_ENABLED – ADC12 clock is enabled

hal_rcc_clk_status_t HAL_RCC_DAC1_IsEnabledClock ( void )

This function checks if the DAC1 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – DAC1 clock is disabled

  • HAL_RCC_CLK_ENABLED – DAC1 clock is enabled

hal_rcc_clk_status_t HAL_RCC_AES_IsEnabledClock ( void )

This function checks if the AES clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – AES clock is disabled

  • HAL_RCC_CLK_ENABLED – AES clock is enabled

hal_rcc_clk_status_t HAL_RCC_HASH_IsEnabledClock ( void )

This function checks if the HASH clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – HASH clock is disabled

  • HAL_RCC_CLK_ENABLED – HASH clock is enabled

hal_rcc_clk_status_t HAL_RCC_RNG_IsEnabledClock ( void )

This function checks if the RNG clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – RNG clock is disabled

  • HAL_RCC_CLK_ENABLED – RNG clock is enabled

Check whether the APB1 peripheral clock is enabled or not.

Note

After reset, the peripheral clock (used for registers read/write access) is disabled and the application software has to enable this clock before using it.

Functions

hal_rcc_clk_status_t HAL_RCC_TIM2_IsEnabledClock ( void )

This function checks if the TIM2 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – TIM2 clock is disabled

  • HAL_RCC_CLK_ENABLED – TIM2 clock is enabled

hal_rcc_clk_status_t HAL_RCC_TIM5_IsEnabledClock ( void )

This function checks if the TIM5 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – TIM5 clock is disabled

  • HAL_RCC_CLK_ENABLED – TIM5 clock is enabled

hal_rcc_clk_status_t HAL_RCC_TIM6_IsEnabledClock ( void )

This function checks if the TIM6 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – TIM6 clock is disabled

  • HAL_RCC_CLK_ENABLED – TIM6 clock is enabled

hal_rcc_clk_status_t HAL_RCC_TIM7_IsEnabledClock ( void )

This function checks if the TIM7 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – TIM7 clock is disabled

  • HAL_RCC_CLK_ENABLED – TIM7 clock is enabled

hal_rcc_clk_status_t HAL_RCC_TIM12_IsEnabledClock ( void )

This function checks if the TIM12 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – TIM12 clock is disabled

  • HAL_RCC_CLK_ENABLED – TIM12 clock is enabled

hal_rcc_clk_status_t HAL_RCC_WWDG_IsEnabledClock ( void )

This function checks if the WWDG clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – WWDG clock is disabled

  • HAL_RCC_CLK_ENABLED – WWDG clock is enabled

hal_rcc_clk_status_t HAL_RCC_SPI2_IsEnabledClock ( void )

This function checks if the SPI2 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – SPI2 clock is disabled

  • HAL_RCC_CLK_ENABLED – SPI2 clock is enabled

hal_rcc_clk_status_t HAL_RCC_SPI3_IsEnabledClock ( void )

This function checks if the SPI3 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – SPI3 clock is disabled

  • HAL_RCC_CLK_ENABLED – SPI3 clock is enabled

hal_rcc_clk_status_t HAL_RCC_USART2_IsEnabledClock ( void )

This function checks if the USART2 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – USART2 clock is disabled

  • HAL_RCC_CLK_ENABLED – USART2 clock is enabled

hal_rcc_clk_status_t HAL_RCC_USART3_IsEnabledClock ( void )

This function checks if the USART3 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – USART3 clock is disabled

  • HAL_RCC_CLK_ENABLED – USART3 clock is enabled

hal_rcc_clk_status_t HAL_RCC_UART4_IsEnabledClock ( void )

This function checks if the UART4 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – UART4 clock is disabled

  • HAL_RCC_CLK_ENABLED – UART4 clock is enabled

hal_rcc_clk_status_t HAL_RCC_UART5_IsEnabledClock ( void )

This function checks if the UART5 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – UART5 clock is disabled

  • HAL_RCC_CLK_ENABLED – UART5 clock is enabled

hal_rcc_clk_status_t HAL_RCC_I2C1_IsEnabledClock ( void )

This function checks if the I2C1 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – I2C1 clock is disabled

  • HAL_RCC_CLK_ENABLED – I2C1 clock is enabled

hal_rcc_clk_status_t HAL_RCC_I2C2_IsEnabledClock ( void )

This function checks if the I2C2 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – I2C2 clock is disabled

  • HAL_RCC_CLK_ENABLED – I2C2 clock is enabled

hal_rcc_clk_status_t HAL_RCC_I3C1_IsEnabledClock ( void )

This function checks if the I3C1 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – I3C1 clock is disabled

  • HAL_RCC_CLK_ENABLED – I3C1 clock is enabled

hal_rcc_clk_status_t HAL_RCC_CRS_IsEnabledClock ( void )

This function checks if the CRS clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – CRS clock is disabled

  • HAL_RCC_CLK_ENABLED – CRS clock is enabled

hal_rcc_clk_status_t HAL_RCC_COMP12_IsEnabledClock ( void )

This function checks if the COMP12 clock is enabled.

Note

COMP2 not defined in all devices.

Return values :
  • HAL_RCC_CLK_DISABLED – COMP12 clock is disabled

  • HAL_RCC_CLK_ENABLED – COMP12 clock is enabled

hal_rcc_clk_status_t HAL_RCC_FDCAN_IsEnabledClock ( void )

This function checks if the FDCAN clock is enabled.

Note

The FDCAN clock is common for all FDCAN instances

Return values :
  • HAL_RCC_CLK_DISABLED – FDCAN clock is disabled

  • HAL_RCC_CLK_ENABLED – FDCAN clock is enabled

Check whether the APB2 peripheral clock is enabled or not.

Note

After reset, the peripheral clock (used for registers read/write access) is disabled and the application software has to enable this clock before using it.

Functions

hal_rcc_clk_status_t HAL_RCC_TIM1_IsEnabledClock ( void )

This function checks if the TIM1 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – TIM1 clock is disabled

  • HAL_RCC_CLK_ENABLED – TIM1 clock is enabled

hal_rcc_clk_status_t HAL_RCC_SPI1_IsEnabledClock ( void )

This function checks if the SPI1 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – SPI1 clock is disabled

  • HAL_RCC_CLK_ENABLED – SPI1 clock is enabled

hal_rcc_clk_status_t HAL_RCC_TIM8_IsEnabledClock ( void )

This function checks if the TIM8 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – TIM8 clock is disabled

  • HAL_RCC_CLK_ENABLED – TIM8 clock is enabled

hal_rcc_clk_status_t HAL_RCC_USART1_IsEnabledClock ( void )

This function checks if the USART1 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – USART1 clock is disabled

  • HAL_RCC_CLK_ENABLED – USART1 clock is enabled

hal_rcc_clk_status_t HAL_RCC_TIM15_IsEnabledClock ( void )

This function checks if the TIM15 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – TIM15 clock is disabled

  • HAL_RCC_CLK_ENABLED – TIM15 clock is enabled

hal_rcc_clk_status_t HAL_RCC_TIM16_IsEnabledClock ( void )

This function checks if the TIM16 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – TIM16 clock is disabled

  • HAL_RCC_CLK_ENABLED – TIM16 clock is enabled

hal_rcc_clk_status_t HAL_RCC_TIM17_IsEnabledClock ( void )

This function checks if the TIM17 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – TIM17 clock is disabled

  • HAL_RCC_CLK_ENABLED – TIM17 clock is enabled

hal_rcc_clk_status_t HAL_RCC_USB_IsEnabledClock ( void )

This function checks if the USB clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – USB clock is disabled

  • HAL_RCC_CLK_ENABLED – USB clock is enabled

Check whether the APB3 peripheral clock is enabled or not.

Note

After reset, the peripheral clock (used for registers read/write access) is disabled and the application software has to enable this clock before using it.

Functions

hal_rcc_clk_status_t HAL_RCC_SBS_IsEnabledClock ( void )

This function checks if the SBS clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – SBS clock is disabled

  • HAL_RCC_CLK_ENABLED – SBS clock is enabled

hal_rcc_clk_status_t HAL_RCC_LPUART1_IsEnabledClock ( void )

This function checks if the LPUART1 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – LPUART1 clock is disabled

  • HAL_RCC_CLK_ENABLED – LPUART1 clock is enabled

hal_rcc_clk_status_t HAL_RCC_LPTIM1_IsEnabledClock ( void )

This function checks if the LPTIM1 clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – LPTIM1 clock is disabled

  • HAL_RCC_CLK_ENABLED – LPTIM1 clock is enabled

hal_rcc_clk_status_t HAL_RCC_RTCAPB_IsEnabledClock ( void )

This function checks if the RTCAPB clock is enabled.

Return values :
  • HAL_RCC_CLK_DISABLED – RTCAPB clock is disabled

  • HAL_RCC_CLK_ENABLED – RTCAPB clock is enabled

AHB1 peripheral reset.

Functions

void HAL_RCC_LPDMA1_Reset ( void )

This function resets the LPDMA1 peripheral.

void HAL_RCC_LPDMA2_Reset ( void )

This function resets the LPDMA2 peripheral.

void HAL_RCC_CRC_Reset ( void )

This function resets the CRC peripheral.

void HAL_RCC_CORDIC_Reset ( void )

This function resets the CORDIC peripheral.

void HAL_RCC_RAMCFG_Reset ( void )

This function resets the RAMCFG peripheral.

AHB2 peripheral reset.

Functions

void HAL_RCC_GPIOA_Reset ( void )

This function resets the GPIOA peripheral.

void HAL_RCC_GPIOB_Reset ( void )

This function resets the GPIOB peripheral.

void HAL_RCC_GPIOC_Reset ( void )

This function resets the GPIOC peripheral.

void HAL_RCC_GPIOD_Reset ( void )

This function resets the GPIOD peripheral.

void HAL_RCC_GPIOE_Reset ( void )

This function resets the GPIOE peripheral.

void HAL_RCC_GPIOH_Reset ( void )

This function resets the GPIOH peripheral.

void HAL_RCC_ADC12_Reset ( void )

This function resets the ADC12 peripheral.

void HAL_RCC_DAC1_Reset ( void )

This function resets the DAC1 peripheral.

void HAL_RCC_AES_Reset ( void )

This function resets the AES peripheral.

void HAL_RCC_HASH_Reset ( void )

This function resets the HASH peripheral.

void HAL_RCC_RNG_Reset ( void )

This function resets the RNG peripheral.

APB1 peripheral reset.

Functions

void HAL_RCC_TIM2_Reset ( void )

This function resets the TIM2 peripheral.

void HAL_RCC_TIM5_Reset ( void )

This function resets the TIM5 peripheral.

void HAL_RCC_TIM6_Reset ( void )

This function resets the TIM6 peripheral.

void HAL_RCC_TIM7_Reset ( void )

This function resets the TIM7 peripheral.

void HAL_RCC_TIM12_Reset ( void )

This function resets the TIM12 peripheral.

void HAL_RCC_SPI2_Reset ( void )

This function resets the SPI2 peripheral.

void HAL_RCC_SPI3_Reset ( void )

This function resets the SPI3 peripheral.

void HAL_RCC_USART2_Reset ( void )

This function resets the USART2 peripheral.

void HAL_RCC_USART3_Reset ( void )

This function resets the USART3 peripheral.

void HAL_RCC_UART4_Reset ( void )

This function resets the UART4 peripheral.

void HAL_RCC_UART5_Reset ( void )

This function resets the UART5 peripheral.

void HAL_RCC_I2C1_Reset ( void )

This function resets the I2C1 peripheral.

void HAL_RCC_I2C2_Reset ( void )

This function resets the I2C2 peripheral.

void HAL_RCC_I3C1_Reset ( void )

This function resets the I3C1 peripheral.

void HAL_RCC_CRS_Reset ( void )

This function resets the CRS peripheral.

void HAL_RCC_COMP12_Reset ( void )

This function resets the COMP12 peripheral.

Note

COMP2 not defined in all devices.

void HAL_RCC_FDCAN_Reset ( void )

This function resets the FDCAN peripheral.

Note

The FDCAN clock is common for all FDCAN instances

APB2 peripheral reset.

Functions

void HAL_RCC_TIM1_Reset ( void )

This function resets the TIM1 peripheral.

void HAL_RCC_SPI1_Reset ( void )

This function resets the SPI1 peripheral.

void HAL_RCC_TIM8_Reset ( void )

This function resets the TIM8 peripheral.

void HAL_RCC_USART1_Reset ( void )

This function resets the USART1 peripheral.

void HAL_RCC_TIM15_Reset ( void )

This function resets the TIM15 peripheral.

void HAL_RCC_TIM16_Reset ( void )

This function resets the TIM16 peripheral.

void HAL_RCC_TIM17_Reset ( void )

This function resets the TIM17 peripheral.

void HAL_RCC_USB_Reset ( void )

This function resets the USB peripheral.

APB3 peripheral reset.

Functions

void HAL_RCC_SBS_Reset ( void )

This function resets the SBS peripheral.

void HAL_RCC_LPUART1_Reset ( void )

This function resets the LPUART1 peripheral.

void HAL_RCC_LPTIM1_Reset ( void )

This function resets the LPTIM1 peripheral.

Enable or disable the AHB1 peripheral clock during Sleep mode.

Note

Peripheral clock gating in SLEEP mode can be used to further reduce power consumption.

Note

After wakeup from SLEEP mode, the peripheral clock is enabled again.

Note

By default, all peripheral clocks are enabled during SLEEP mode.

Functions

void HAL_RCC_LP_LPDMA1_EnableClockInSleepMode ( void )

This function enables the LPDMA1 clock in sleep mode.

void HAL_RCC_LP_LPDMA2_EnableClockInSleepMode ( void )

This function enables the LPDMA2 clock in sleep mode.

void HAL_RCC_LP_FLASH_EnableClockInSleepMode ( void )

This function enables the FLASH clock in sleep mode.

void HAL_RCC_LP_CRC_EnableClockInSleepMode ( void )

This function enables the CRC clock in sleep mode.

void HAL_RCC_LP_CORDIC_EnableClockInSleepMode ( void )

This function enables the CORDIC clock in sleep mode.

void HAL_RCC_LP_RAMCFG_EnableClockInSleepMode ( void )

This function enables the RAMCFG clock in sleep mode.

void HAL_RCC_LP_ICACHE1_EnableClockInSleepMode ( void )

This function enables the ICACHE1 clock in sleep mode.

void HAL_RCC_LP_SRAM2_EnableClockInSleepMode ( void )

This function enables the SRAM2 clock in sleep mode.

void HAL_RCC_LP_SRAM2_EnableClockInStopMode ( void )

This function enables the SRAM2 clock in stop mode.

void HAL_RCC_LP_SRAM1_EnableClockInSleepMode ( void )

This function enables the SRAM1 clock in sleep mode.

void HAL_RCC_LP_SRAM1_EnableClockInStopMode ( void )

This function enables the SRAM1 clock in stop mode.

void HAL_RCC_LP_LPDMA1_DisableClockInSleepMode ( void )

This function disables the LPDMA1 clock in sleep mode.

void HAL_RCC_LP_LPDMA2_DisableClockInSleepMode ( void )

This function disables the LPDMA2 clock in sleep mode.

void HAL_RCC_LP_FLASH_DisableClockInSleepMode ( void )

This function disables the FLASH clock in sleep mode.

void HAL_RCC_LP_CRC_DisableClockInSleepMode ( void )

This function disables the CRC clock in sleep mode.

void HAL_RCC_LP_CORDIC_DisableClockInSleepMode ( void )

This function disables the CORDIC clock in sleep mode.

void HAL_RCC_LP_RAMCFG_DisableClockInSleepMode ( void )

This function disables the RAMCFG clock in sleep mode.

void HAL_RCC_LP_ICACHE1_DisableClockInSleepMode ( void )

This function disables the ICACHE1 clock in sleep mode.

void HAL_RCC_LP_SRAM2_DisableClockInSleepMode ( void )

This function disables the SRAM2 clock in sleep mode.

void HAL_RCC_LP_SRAM2_DisableClockInStopMode ( void )

This function disables the SRAM2 clock in stop mode.

void HAL_RCC_LP_SRAM1_DisableClockInSleepMode ( void )

This function disables the SRAM1 clock in sleep mode.

void HAL_RCC_LP_SRAM1_DisableClockInStopMode ( void )

This function disables the SRAM1 clock in stop mode.

Enable or disable the AHB2 peripheral clock during Sleep mode.

Note

Peripheral clock gating in SLEEP mode can be used to further reduce power consumption.

Note

After wakeup from SLEEP mode, the peripheral clock is enabled again.

Note

By default, all peripheral clocks are enabled during SLEEP mode.

Functions

void HAL_RCC_LP_GPIOA_EnableClockInSleepMode ( void )

This function enables the GPIOA clock in sleep mode.

void HAL_RCC_LP_GPIOB_EnableClockInSleepMode ( void )

This function enables the GPIOB clock in sleep mode.

void HAL_RCC_LP_GPIOC_EnableClockInSleepMode ( void )

This function enables the GPIOC clock in sleep mode.

void HAL_RCC_LP_GPIOD_EnableClockInSleepMode ( void )

This function enables the GPIOD clock in sleep mode.

void HAL_RCC_LP_GPIOE_EnableClockInSleepMode ( void )

This function enables the GPIOE clock in sleep mode.

void HAL_RCC_LP_GPIOH_EnableClockInSleepMode ( void )

This function enables the GPIOH clock in sleep mode.

void HAL_RCC_LP_ADC12_EnableClockInSleepMode ( void )

This function enables the ADC12 clock in sleep mode.

void HAL_RCC_LP_DAC1_EnableClockInSleepMode ( void )

This function enables the DAC1 clock in sleep mode.

void HAL_RCC_LP_DAC1_EnableClockInStopMode ( void )

This function enables the DAC1 clock in stop mode.

void HAL_RCC_LP_AES_EnableClockInSleepMode ( void )

This function enables the AES clock in sleep mode.

void HAL_RCC_LP_HASH_EnableClockInSleepMode ( void )

This function enables the HASH clock in sleep mode.

void HAL_RCC_LP_RNG_EnableClockInSleepMode ( void )

This function enables the RNG clock in sleep mode.

void HAL_RCC_LP_GPIOA_DisableClockInSleepMode ( void )

This function disables the GPIOA clock in sleep mode.

void HAL_RCC_LP_GPIOB_DisableClockInSleepMode ( void )

This function disables the GPIOB clock in sleep mode.

void HAL_RCC_LP_GPIOC_DisableClockInSleepMode ( void )

This function disables the GPIOC clock in sleep mode.

void HAL_RCC_LP_GPIOD_DisableClockInSleepMode ( void )

This function disables the GPIOD clock in sleep mode.

void HAL_RCC_LP_GPIOE_DisableClockInSleepMode ( void )

This function disables the GPIOE clock in sleep mode.

void HAL_RCC_LP_GPIOH_DisableClockInSleepMode ( void )

This function disables the GPIOH clock in sleep mode.

void HAL_RCC_LP_ADC12_DisableClockInSleepMode ( void )

This function disables the ADC12 clock in sleep mode.

void HAL_RCC_LP_DAC1_DisableClockInSleepMode ( void )

This function disables the DAC1 clock in sleep mode.

void HAL_RCC_LP_DAC1_DisableClockInStopMode ( void )

This function disables the DAC1 clock in stop mode.

void HAL_RCC_LP_AES_DisableClockInSleepMode ( void )

This function disables the AES clock in sleep mode.

void HAL_RCC_LP_HASH_DisableClockInSleepMode ( void )

This function disables the HASH clock in sleep mode.

void HAL_RCC_LP_RNG_DisableClockInSleepMode ( void )

This function disables the RNG clock in sleep mode.

Enable or disable the APB1 peripheral clock during Low Power Sleep mode.

Note

Peripheral clock gating in SLEEP mode can be used to further reduce power consumption.

Note

After wakeup from SLEEP, the peripheral clock is enabled again.

Note

By default, all peripheral clocks are enabled during SLEEP mode.

Functions

void HAL_RCC_LP_TIM2_EnableClockInSleepMode ( void )

This function enables the TIM2 clock in sleep mode.

void HAL_RCC_LP_TIM5_EnableClockInSleepMode ( void )

This function enables the TIM5 clock in sleep mode.

void HAL_RCC_LP_TIM6_EnableClockInSleepMode ( void )

This function enables the TIM6 clock in sleep mode.

void HAL_RCC_LP_TIM7_EnableClockInSleepMode ( void )

This function enables the TIM7 clock in sleep mode.

void HAL_RCC_LP_TIM12_EnableClockInSleepMode ( void )

This function enables the TIM12 clock in sleep mode.

void HAL_RCC_LP_WWDG_EnableClockInSleepMode ( void )

This function enables the WWDG clock in sleep mode.

void HAL_RCC_LP_SPI2_EnableClockInSleepMode ( void )

This function enables the SPI2 clock in sleep mode.

void HAL_RCC_LP_SPI2_EnableClockInStopMode ( void )

This function enables the SPI2 clock in stop mode.

void HAL_RCC_LP_SPI3_EnableClockInSleepMode ( void )

This function enables the SPI3 clock in sleep mode.

void HAL_RCC_LP_SPI3_EnableClockInStopMode ( void )

This function enables the SPI3 clock in stop mode.

void HAL_RCC_LP_USART2_EnableClockInSleepMode ( void )

This function enables the USART2 clock in sleep mode.

void HAL_RCC_LP_USART2_EnableClockInStopMode ( void )

This function enables the USART2 clock in stop mode.

void HAL_RCC_LP_USART3_EnableClockInSleepMode ( void )

This function enables the USART3 clock in sleep mode.

void HAL_RCC_LP_USART3_EnableClockInStopMode ( void )

This function enables the USART3 clock in stop mode.

void HAL_RCC_LP_UART4_EnableClockInSleepMode ( void )

This function enables the UART4 clock in sleep mode.

void HAL_RCC_LP_UART4_EnableClockInStopMode ( void )

This function enables the UART4 clock in stop mode.

void HAL_RCC_LP_UART5_EnableClockInSleepMode ( void )

This function enables the UART5 clock in sleep mode.

void HAL_RCC_LP_UART5_EnableClockInStopMode ( void )

This function enables the UART5 clock in stop mode.

void HAL_RCC_LP_I2C1_EnableClockInSleepMode ( void )

This function enables the I2C1 clock in sleep mode.

void HAL_RCC_LP_I2C1_EnableClockInStopMode ( void )

This function enables the I2C1 clock in stop mode.

void HAL_RCC_LP_I2C2_EnableClockInSleepMode ( void )

This function enables the I2C2 clock in sleep mode.

void HAL_RCC_LP_I2C2_EnableClockInStopMode ( void )

This function enables the I2C2 clock in stop mode.

void HAL_RCC_LP_I3C1_EnableClockInSleepMode ( void )

This function enables the I3C1 clock in sleep mode.

void HAL_RCC_LP_I3C1_EnableClockInStopMode ( void )

This function enables the I3C1 clock in stop mode.

void HAL_RCC_LP_CRS_EnableClockInSleepMode ( void )

This function enables the CRS clock in sleep mode.

void HAL_RCC_LP_COMP12_EnableClockInSleepMode ( void )

This function enables the COMP12 clock in sleep mode.

Note

COMP2 not defined in all devices.

void HAL_RCC_LP_COMP12_EnableClockInStopMode ( void )

This function enables the COMP12 clock in stop mode.

Note

COMP2 not defined in all devices.

void HAL_RCC_LP_FDCAN_EnableClockInSleepMode ( void )

This function enables the FDCAN clock in sleep mode.

Note

The FDCAN clock is common for all FDCAN instances

void HAL_RCC_LP_TIM2_DisableClockInSleepMode ( void )

This function disables the TIM2 clock in sleep mode.

void HAL_RCC_LP_TIM5_DisableClockInSleepMode ( void )

This function disables the TIM5 clock in sleep mode.

void HAL_RCC_LP_TIM6_DisableClockInSleepMode ( void )

This function disables the TIM6 clock in sleep mode.

void HAL_RCC_LP_TIM7_DisableClockInSleepMode ( void )

This function disables the TIM7 clock in sleep mode.

void HAL_RCC_LP_TIM12_DisableClockInSleepMode ( void )

This function disables the TIM12 clock in sleep mode.

void HAL_RCC_LP_WWDG_DisableClockInSleepMode ( void )

This function disables the WWDG clock in sleep mode.

void HAL_RCC_LP_SPI2_DisableClockInSleepMode ( void )

This function disables the SPI2 clock in sleep mode.

void HAL_RCC_LP_SPI2_DisableClockInStopMode ( void )

This function disables the SPI2 clock in stop mode.

void HAL_RCC_LP_SPI3_DisableClockInSleepMode ( void )

This function disables the SPI3 clock in sleep mode.

void HAL_RCC_LP_SPI3_DisableClockInStopMode ( void )

This function disables the SPI3 clock in stop mode.

void HAL_RCC_LP_USART2_DisableClockInSleepMode ( void )

This function disables the USART2 clock in sleep mode.

void HAL_RCC_LP_USART2_DisableClockInStopMode ( void )

This function disables the USART2 clock in stop mode.

void HAL_RCC_LP_USART3_DisableClockInSleepMode ( void )

This function disables the USART3 clock in sleep mode.

void HAL_RCC_LP_USART3_DisableClockInStopMode ( void )

This function disables the USART3 clock in stop mode.

void HAL_RCC_LP_UART4_DisableClockInSleepMode ( void )

This function disables the UART4 clock in sleep mode.

void HAL_RCC_LP_UART4_DisableClockInStopMode ( void )

This function disables the UART4 clock in stop mode.

void HAL_RCC_LP_UART5_DisableClockInSleepMode ( void )

This function disables the UART5 clock in sleep mode.

void HAL_RCC_LP_UART5_DisableClockInStopMode ( void )

This function disables the UART5 clock in stop mode.

void HAL_RCC_LP_I2C1_DisableClockInSleepMode ( void )

This function disables the I2C1 clock in sleep mode.

void HAL_RCC_LP_I2C1_DisableClockInStopMode ( void )

This function disables the I2C1 clock in stop mode.

void HAL_RCC_LP_I2C2_DisableClockInSleepMode ( void )

This function disables the I2C2 clock in sleep mode.

void HAL_RCC_LP_I2C2_DisableClockInStopMode ( void )

This function disables the I2C2 clock in stop mode.

void HAL_RCC_LP_I3C1_DisableClockInSleepMode ( void )

This function disables the I3C1 clock in sleep mode.

void HAL_RCC_LP_I3C1_DisableClockInStopMode ( void )

This function disables the I3C1 clock in stop mode.

void HAL_RCC_LP_CRS_DisableClockInSleepMode ( void )

This function disables the CRS clock in sleep mode.

void HAL_RCC_LP_COMP12_DisableClockInSleepMode ( void )

This function disables the COMP12 clock in sleep mode.

Note

COMP2 not defined in all devices.

void HAL_RCC_LP_COMP12_DisableClockInStopMode ( void )

This function disables the COMP12 clock in stop mode.

Note

COMP2 not defined in all devices.

void HAL_RCC_LP_FDCAN_DisableClockInSleepMode ( void )

This function disables the FDCAN clock in sleep mode.

Note

The FDCAN clock is common for all FDCAN instances

Enable or disable the APB2 peripheral clock during Low Power Sleep mode.

Note

Peripheral clock gating in SLEEP mode can be used to further reduce power consumption.

Note

After wakeup from SLEEP, the peripheral clock is enabled again.

Note

By default, all peripheral clocks are enabled during SLEEP mode.

Functions

void HAL_RCC_LP_TIM1_EnableClockInSleepMode ( void )

This function enables the TIM1 clock in sleep mode.

void HAL_RCC_LP_SPI1_EnableClockInSleepMode ( void )

This function enables the SPI1 clock in sleep mode.

void HAL_RCC_LP_SPI1_EnableClockInStopMode ( void )

This function enables the SPI1 clock in stop mode.

void HAL_RCC_LP_TIM8_EnableClockInSleepMode ( void )

This function enables the TIM8 clock in sleep mode.

void HAL_RCC_LP_USART1_EnableClockInSleepMode ( void )

This function enables the USART1 clock in sleep mode.

void HAL_RCC_LP_USART1_EnableClockInStopMode ( void )

This function enables the USART1 clock in stop mode.

void HAL_RCC_LP_TIM15_EnableClockInSleepMode ( void )

This function enables the TIM15 clock in sleep mode.

void HAL_RCC_LP_TIM16_EnableClockInSleepMode ( void )

This function enables the TIM16 clock in sleep mode.

void HAL_RCC_LP_TIM17_EnableClockInSleepMode ( void )

This function enables the TIM17 clock in sleep mode.

void HAL_RCC_LP_USB_EnableClockInSleepMode ( void )

This function enables the USB clock in sleep mode.

void HAL_RCC_LP_USB_EnableClockInStopMode ( void )

This function enables the USB clock in stop mode.

void HAL_RCC_LP_TIM1_DisableClockInSleepMode ( void )

This function disables the TIM1 clock in sleep mode.

void HAL_RCC_LP_SPI1_DisableClockInSleepMode ( void )

This function disables the SPI1 clock in sleep mode.

void HAL_RCC_LP_SPI1_DisableClockInStopMode ( void )

This function disables the SPI1 clock in stop mode.

void HAL_RCC_LP_TIM8_DisableClockInSleepMode ( void )

This function disables the TIM8 clock in sleep mode.

void HAL_RCC_LP_USART1_DisableClockInSleepMode ( void )

This function disables the USART1 clock in sleep mode.

void HAL_RCC_LP_USART1_DisableClockInStopMode ( void )

This function disables the USART1 clock in stop mode.

void HAL_RCC_LP_TIM15_DisableClockInSleepMode ( void )

This function disables the TIM15 clock in sleep mode.

void HAL_RCC_LP_TIM16_DisableClockInSleepMode ( void )

This function disables the TIM16 clock in sleep mode.

void HAL_RCC_LP_TIM17_DisableClockInSleepMode ( void )

This function disables the TIM17 clock in sleep mode.

void HAL_RCC_LP_USB_DisableClockInSleepMode ( void )

This function disables the USB clock in sleep mode.

void HAL_RCC_LP_USB_DisableClockInStopMode ( void )

This function disables the USB clock in stop mode.

Enable or disable the APB3 peripheral clock during Low Power Sleep mode.

Note

Peripheral clock gating in SLEEP mode can be used to further reduce power consumption.

Note

After wakeup from SLEEP, the peripheral clock is enabled again.

Note

By default, all peripheral clocks are enabled during SLEEP mode.

Functions

void HAL_RCC_LP_SBS_EnableClockInSleepMode ( void )

This function enables the SBS clock in sleep mode.

void HAL_RCC_LP_LPUART1_EnableClockInSleepMode ( void )

This function enables the LPUART1 clock in sleep mode.

void HAL_RCC_LP_LPUART1_EnableClockInStopMode ( void )

This function enables the LPUART1 clock in stop mode.

void HAL_RCC_LP_LPTIM1_EnableClockInSleepMode ( void )

This function enables the LPTIM1 clock in sleep mode.

void HAL_RCC_LP_LPTIM1_EnableClockInStopMode ( void )

This function enables the LPTIM1 clock in stop mode.

void HAL_RCC_LP_RTCAPB_EnableClockInSleepMode ( void )

This function enables the RTCAPB clock in sleep mode.

void HAL_RCC_LP_RTCAPB_EnableClockInStopMode ( void )

This function enables the RTCAPB clock in stop mode.

void HAL_RCC_LP_SBS_DisableClockInSleepMode ( void )

This function disables the SBS clock in sleep mode.

void HAL_RCC_LP_LPUART1_DisableClockInSleepMode ( void )

This function disables the LPUART1 clock in sleep mode.

void HAL_RCC_LP_LPUART1_DisableClockInStopMode ( void )

This function disables the LPUART1 clock in stop mode.

void HAL_RCC_LP_LPTIM1_DisableClockInSleepMode ( void )

This function disables the LPTIM1 clock in sleep mode.

void HAL_RCC_LP_LPTIM1_DisableClockInStopMode ( void )

This function disables the LPTIM1 clock in stop mode.

void HAL_RCC_LP_RTCAPB_DisableClockInSleepMode ( void )

This function disables the RTCAPB clock in sleep mode.

void HAL_RCC_LP_RTCAPB_DisableClockInStopMode ( void )

This function disables the RTCAPB clock in stop mode.

Reset the RTC domain.

Functions

void HAL_RCC_ResetRTCDomain ( void )

Function to force and release the RTC domain.

When a RTC domain reset occurs, the following domains are impacted:

  • the RTC is stopped and all the RTC registers are set to their reset values (including the backup registers)

  • all TAMP registers can be read or written.

  • LSE crystal 32kHz crystal oscillator

  • RCC_RTCCR register

RCC services functions

group RCC_Exported_Functions_Group3

This subsection provides a set of functions allowing to:

  • Configure the MCO.

    • MCO (Microcontroller Clock Output): used to output HSIK, HSIS, HSIDIV3, PSIK, PSIS, PSIDIV3, LSE, LSI, HSE, SYSCLK on a pin.

  • Get and clear reset flags

  • Enable the Clock Security System.

    • CSS (Clock Security System): once enabled, if a HSE clock failure occurs (HSE used directly or through PSI as System clock source), the System clock is automatically switched to HSI. If a LSE clock failure occurs (LSE used through PSI as System clock source), the System clock is automatically switched to HSI. The CSS is linked to the Cortex-M33 NMI (non-maskable interrupt) exception vector. The NMI is executed indefinitely unless the CSS interrupt flag (CSSF) pending bit is cleared. Therefore, in the NMI ISR, ensure to clear the CSSF by setting the CSSC bit.

  • Enable Clock security system on LSE.

  • Configure and get the oscillator Kernel clock source for wakeup from Stop.

  • Enable output (LSCO) allows one of the low-speed clocks below to be output onto the external LSCO pin:

    • LSI

    • LSE

    • This output remains available in all Stop modes and Standby mode

  • Enable RTC and TAMP clock

Functions

void HAL_RCC_SetConfigMCO ( hal_rcc_mco_src_t mcox_src , hal_rcc_mco_prescaler_t mco_prescaler )

Select the clock source to output on MCO pin.

Warning

MCO selected pin must be configured in alternate function mode.

Parameters :
  • mcox_src – specifies the clock source to output.

  • mco_prescaler – specifies the MCO prescaler.

uint32_t HAL_RCC_GetResetSource ( void )

Get reset flags.

Return values :

uint32_t – Reset flags based on a combination of Reset Flag

void HAL_RCC_ClearResetFlags ( void )

Clear reset flags.

hal_status_t HAL_RCC_NMI_IRQHandler ( void )

Handle the RCC Clock Security System interrupt request.

Warning

Call this API under the NMI_Handler().

Return values :
  • HAL_OK – NMI has been managed and NMI_Handler() might exit

  • HAL_ERROR – NMI has not been managed and NMI_Handler() must not exit

void HAL_RCC_SetClockAfterWakeFromStop ( hal_rcc_stop_wakeup_clk_t wakeup_clk )

Configure the oscillator clock source for wakeup from Stop and CSS backup clock.

Warning

Do not call this function after the Clock Security System on HSE has been enabled.

Parameters :

wakeup_clk – Wakeup clock This parameter can be one of the following values:

hal_rcc_stop_wakeup_clk_t HAL_RCC_GetClockAfterWakeFromStop ( void )

Get the oscillator clock source for wakeup from Stop and CSS backup clock.

Return values :
  • HAL_RCC_STOP_WAKEUPCLOCK_HSIS – HSI clock selection.

  • HAL_RCC_STOP_WAKEUPCLOCK_HSIDIV3 – HSI/3 clock selection.

hal_status_t HAL_RCC_EnableLSCO ( hal_rcc_lsco_src_t source )

Select source clock to use on the Low Speed Clock Output (LSCO).

Note

PWR and backup domain are to be enabled before calling this function.

Parameters :

source – specifies the Low Speed clock source to output.

Return values :
  • HAL_OK – LSCO activated

  • HAL_ERROR – Backup domain is not enabled

hal_status_t HAL_RCC_DisableLSCO ( void )

Disable the Low Speed Clock Output (LSCO).

Note

PWR and backup domain are to be enabled before calling this function.

Return values :
  • HAL_OK – LSCO Deactivated

  • HAL_ERROR – LSCO is not disabled

hal_status_t HAL_RCC_RTC_EnableKernelClock ( void )

Enable RTC and TAMP kernel clock.

Note

PWR and backup domain are to be enabled before calling this function.

Return values :
  • HAL_OK – RTC and TAMP kernel clock enabled

  • HAL_ERROR – Backup domain is not enabled

hal_status_t HAL_RCC_RTC_DisableKernelClock ( void )

Disable RTC and TAMP kernel clock.

Note

PWR and backup domain are to be enabled before calling this function.

Return values :
  • HAL_OK – RTC and TAMP kernel clock disabled

  • HAL_ERROR – Backup domain is not disabled

Kernel clock source configuration for peripherals

group RCC_Exported_Functions_Group4

This subsection provides a set of functions:

  • to control Kernel clock source configuration for peripherals

  • to control specific Kernel clock prescaler for peripherals if available

  • to get peripheral clock frequency

Only functions having a kernel clock are handled by these functions.

Functions

hal_status_t HAL_RCC_USART1_SetKernelClkSource ( hal_rcc_usart1_clk_src_t clk_src )

Set the USART1 clock source.

Parameters :

clk_src – Clock source selection based on hal_rcc_usart1_clk_src_t

Return values :

HAL_OK – Source clock has been selected

hal_status_t HAL_RCC_USART2_SetKernelClkSource ( hal_rcc_usart2_clk_src_t clk_src )

Set the USART2 clock source.

Parameters :

clk_src – Clock source selection based on hal_rcc_usart2_clk_src_t

Return values :

HAL_OK – Source clock has been selected

hal_status_t HAL_RCC_USART3_SetKernelClkSource ( hal_rcc_usart3_clk_src_t clk_src )

Set the USART3 clock source.

Parameters :

clk_src – Clock source selection based on hal_rcc_usart3_clk_src_t

Return values :

HAL_OK – Source clock has been selected

hal_status_t HAL_RCC_UART4_SetKernelClkSource ( hal_rcc_uart4_clk_src_t clk_src )

Set the UART4 clock source.

Parameters :

clk_src – Clock source selection based on hal_rcc_uart4_clk_src_t

Return values :

HAL_OK – Source clock has been selected

hal_status_t HAL_RCC_UART5_SetKernelClkSource ( hal_rcc_uart5_clk_src_t clk_src )

Set the UART5 clock source.

Parameters :

clk_src – Clock source selection based on hal_rcc_uart5_clk_src_t

Return values :

HAL_OK – Source clock has been selected

hal_status_t HAL_RCC_LPUART1_SetKernelClkSource ( hal_rcc_lpuart1_clk_src_t clk_src )

Set the LPUART1 clock source.

Parameters :

clk_src – Clock source selection based on hal_rcc_lpuart1_clk_src_t

Return values :

HAL_OK – Source clock has been selected

hal_status_t HAL_RCC_SPI1_SetKernelClkSource ( hal_rcc_spi1_clk_src_t clk_src )

Set the SPI1 clock source.

Parameters :

clk_src – Clock source selection based on hal_rcc_spi1_clk_src_t

Return values :

HAL_OK – Source clock has been selected

hal_status_t HAL_RCC_SPI2_SetKernelClkSource ( hal_rcc_spi2_clk_src_t clk_src )

Set the SPI2 clock source.

Parameters :

clk_src – Clock source selection based on hal_rcc_spi2_clk_src_t

Return values :

HAL_OK – Source clock has been selected

hal_status_t HAL_RCC_SPI3_SetKernelClkSource ( hal_rcc_spi3_clk_src_t clk_src )

Set the SPI3 clock source.

Parameters :

clk_src – Clock source selection based on hal_rcc_spi3_clk_src_t

Return values :

HAL_OK – Source clock has been selected

hal_status_t HAL_RCC_FDCAN_SetKernelClkSource ( hal_rcc_fdcan_clk_src_t clk_src )

Set the FDCAN clock source.

Note

The FDCAN clock is common for all FDCAN instances

Parameters :

clk_src – Clock source selection based on hal_rcc_fdcan_clk_src_t

Return values :

HAL_OK – Source clock has been selected

hal_status_t HAL_RCC_I2C1_SetKernelClkSource ( hal_rcc_i2c1_clk_src_t clk_src )

Set the I2C1 clock source.

Parameters :

clk_src – Clock source selection based on hal_rcc_i2c1_clk_src_t

Return values :

HAL_OK – Source clock has been selected

hal_status_t HAL_RCC_I2C2_SetKernelClkSource ( hal_rcc_i2c2_clk_src_t clk_src )

Set the I2C2 clock source.

Parameters :

clk_src – Clock source selection based on hal_rcc_i2c2_clk_src_t

Return values :

HAL_OK – Source clock has been selected

hal_status_t HAL_RCC_I3C1_SetKernelClkSource ( hal_rcc_i3c1_clk_src_t clk_src )

Set the I3C1 clock source.

Parameters :

clk_src – Clock source selection based on hal_rcc_i3c1_clk_src_t

Return values :

HAL_OK – Source clock has been selected

hal_status_t HAL_RCC_ADCDAC_SetKernelClkSource ( hal_rcc_adcdac_clk_src_t clk_src )

Set the ADCDAC clock source.

Note

This bit must not be changed when ADC or DAC enabled.

Parameters :

clk_src – Clock source selection based on hal_rcc_adcdac_clk_src_t

Return values :

HAL_OK – Source clock has been selected

hal_status_t HAL_RCC_DAC1_SetSampleHoldClkSource ( hal_rcc_dac1_sh_clk_src_t clk_src )

Set the DAC1 sample and hold clock source.

Parameters :

clk_src – Clock source selection based on hal_rcc_dac1_sh_clk_src_t

Return values :

HAL_OK – Source clock has been selected

hal_status_t HAL_RCC_LPTIM1_SetKernelClkSource ( hal_rcc_lptim1_clk_src_t clk_src )

Set the LPTIM1 clock source.

Parameters :

clk_src – Clock source selection based on hal_rcc_lptim1_clk_src_t

Return values :

HAL_OK – Source clock has been selected

hal_status_t HAL_RCC_CK48_SetKernelClkSource ( hal_rcc_ck48_clk_src_t clk_src )

Set the CK48 clock source.

Parameters :

clk_src – Clock source selection based on hal_rcc_ck48_clk_src_t

Return values :

HAL_OK – Source clock has been selected

hal_status_t HAL_RCC_RTC_SetKernelClkSource ( hal_rcc_rtc_clk_src_t clk_src )

Set the RTC clock source.

Warning

Backup domain write access must be enabled before calling this function.

Warning

Modifying the RTC clock source after it has been configured requires performing an RTC domain reset first.

Parameters :

clk_src – Clock source selection based on hal_rcc_rtc_clk_src_t

Return values :
  • HAL_OK – RTC source clock has been selected

  • HAL_ERROR – RTC source clock has not been selected

hal_rcc_usart1_clk_src_t HAL_RCC_USART1_GetKernelClkSource ( void )

Get the USART1 clock source.

Return values :

clk_src – Clock source based on hal_rcc_usart1_clk_src_t

hal_rcc_usart2_clk_src_t HAL_RCC_USART2_GetKernelClkSource ( void )

Get the USART2 clock source.

Return values :

clk_src – Clock source based on hal_rcc_usart2_clk_src_t

hal_rcc_usart3_clk_src_t HAL_RCC_USART3_GetKernelClkSource ( void )

Get the USART3 clock source.

Return values :

clk_src – Clock source based on hal_rcc_usart3_clk_src_t

hal_rcc_uart4_clk_src_t HAL_RCC_UART4_GetKernelClkSource ( void )

Get the UART4 clock source.

Return values :

clk_src – Clock source based on hal_rcc_uart4_clk_src_t

hal_rcc_uart5_clk_src_t HAL_RCC_UART5_GetKernelClkSource ( void )

Get the UART5 clock source.

Return values :

clk_src – Clock source based on hal_rcc_uart5_clk_src_t

hal_rcc_lpuart1_clk_src_t HAL_RCC_LPUART1_GetKernelClkSource ( void )

Get the LPUART1 clock source.

Return values :

clk_src – Clock source based on hal_rcc_lpuart1_clk_src_t

hal_rcc_spi1_clk_src_t HAL_RCC_SPI1_GetKernelClkSource ( void )

Get the SPI1 clock source.

Return values :

clk_src – Clock source based on hal_rcc_spi1_clk_src_t

hal_rcc_spi2_clk_src_t HAL_RCC_SPI2_GetKernelClkSource ( void )

Get the SPI2 clock source.

Return values :

clk_src – Clock source based on hal_rcc_spi2_clk_src_t

hal_rcc_spi3_clk_src_t HAL_RCC_SPI3_GetKernelClkSource ( void )

Get the SPI3 clock source.

Return values :

clk_src – Clock source based on hal_rcc_spi3_clk_src_t

hal_rcc_fdcan_clk_src_t HAL_RCC_FDCAN_GetKernelClkSource ( void )

Get the FDCAN clock source.

Note

The FDCAN clock is common for all FDCAN instances

Return values :

clk_src – Clock source based on hal_rcc_fdcan_clk_src_t

hal_rcc_i2c1_clk_src_t HAL_RCC_I2C1_GetKernelClkSource ( void )

Get the I2C1 clock source.

Return values :

clk_src – Clock source based on hal_rcc_i2c1_clk_src_t

hal_rcc_i2c2_clk_src_t HAL_RCC_I2C2_GetKernelClkSource ( void )

Get the I2C2 clock source.

Return values :

clk_src – Clock source based on hal_rcc_i2c2_clk_src_t

hal_rcc_i3c1_clk_src_t HAL_RCC_I3C1_GetKernelClkSource ( void )

Get the I3C1 clock source.

Return values :

clk_src – Clock source based on hal_rcc_i3c1_clk_src_t

hal_rcc_adcdac_clk_src_t HAL_RCC_ADCDAC_GetKernelClkSource ( void )

Get the ADCDAC clock source.

Return values :

clk_src – Clock source based on hal_rcc_adcdac_clk_src_t

hal_rcc_dac1_sh_clk_src_t HAL_RCC_DAC1_GetSampleHoldClkSource ( void )

Get the DAC1 sample and hold clock source.

Return values :

clk_src – Clock source based on hal_rcc_dac1_sh_clk_src_t

hal_rcc_lptim1_clk_src_t HAL_RCC_LPTIM1_GetKernelClkSource ( void )

Get the LPTIM1 clock source.

Return values :

clk_src – Clock source based on hal_rcc_lptim1_clk_src_t

hal_rcc_ck48_clk_src_t HAL_RCC_CK48_GetKernelClkSource ( void )

Get the CK48 clock source.

Return values :

clk_src – Clock source based on hal_rcc_ck48_clk_src_t

hal_rcc_rtc_clk_src_t HAL_RCC_RTC_GetKernelClkSource ( void )

Get the RTC clock source.

Return values :

clk_src – Clock source based on hal_rcc_rtc_clk_src_t

hal_status_t HAL_RCC_ADCDAC_SetKernelClkPrescaler ( hal_rcc_adcdac_prescaler_t prescaler )

Set the ADCDAC prescaler.

Note

This bit must not be changed when ADC or DAC enabled.

Parameters :

prescaler – Prescaler selection based on hal_rcc_adcdac_prescaler_t

Return values :

HAL_OK – Prescaler has been selected

hal_rcc_adcdac_prescaler_t HAL_RCC_ADCDAC_GetKernelClkPrescaler ( void )

Get the ADCDAC prescaler.

Return values :

value – based on hal_rcc_adcdac_prescaler_t

hal_status_t HAL_RCC_ADCDAC_SetConfigKernelClk ( hal_rcc_adcdac_clk_src_t clk_src , hal_rcc_adcdac_prescaler_t prescaler )

Set the ADCDAC Clock source and prescaler.

Note

Clock source and prescaler can be updated only if ADCDAC is disabled

Parameters :
Return values :

HAL_OK – Clock source and prescaler has been selected HAL_ERROR ADCDAC is enabled

void HAL_RCC_ADCDAC_GetConfigKernelClk ( hal_rcc_adcdac_clk_src_t * p_clk_src , hal_rcc_adcdac_prescaler_t * p_prescaler )

Get the ADCDAC Clock source and prescaler.

Parameters :
uint32_t HAL_RCC_UART_GetKernelClkFreq ( const USART_TypeDef * uartx )

Return the peripheral clock frequency for UART/USART/LPUART.

Parameters :

uartx – UART instance

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_USART1_GetKernelClkFreq ( void )

Return the peripheral clock frequency for USART1.

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_USART2_GetKernelClkFreq ( void )

Return the peripheral clock frequency for USART2.

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_USART3_GetKernelClkFreq ( void )

Return the peripheral clock frequency for USART3.

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_UART4_GetKernelClkFreq ( void )

Return the peripheral clock frequency for UART4.

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_UART5_GetKernelClkFreq ( void )

Return the peripheral clock frequency for UART5.

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_LPUART1_GetKernelClkFreq ( void )

Return the peripheral clock frequency for LPUART1.

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_USART_GetKernelClkFreq ( const USART_TypeDef * usartx )

Return the peripheral clock frequency for USART/SMARTCARD.

Parameters :

usartx – USART instance

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_SPI_GetKernelClkFreq ( const SPI_TypeDef * spix )

Return the peripheral clock frequency for SPI.

Parameters :

spix – SPI instance

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_SPI1_GetKernelClkFreq ( void )

Return the peripheral clock frequency for SPI1.

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_SPI2_GetKernelClkFreq ( void )

Return the peripheral clock frequency for SPI2.

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_SPI3_GetKernelClkFreq ( void )

Return the peripheral clock frequency for SPI3.

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_FDCAN_GetKernelClkFreq ( void )

Return the peripheral clock frequency for FDCAN.

Note

The FDCAN clock is common for all FDCAN instances

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_LPTIM_GetKernelClkFreq ( const LPTIM_TypeDef * lptimx )

Return the peripheral clock frequency for LPTIM.

Parameters :

lptimx – LPTIM instance

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_TIM_GetKernelClkFreq ( const TIM_TypeDef * timx )

Return the peripheral clock frequency for TIM.

Parameters :

timx – TIM instance.

Return values :
  • uint32_t – Frequency in Hz.

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_I2C_GetKernelClkFreq ( const I2C_TypeDef * i2cx )

Return the peripheral clock frequency for I2C/SMBUS.

Parameters :

i2cx – I2C instance

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_I2C1_GetKernelClkFreq ( void )

Return the peripheral clock frequency for I2C1.

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_I2C2_GetKernelClkFreq ( void )

Return the peripheral clock frequency for I2C2.

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_I3C_GetKernelClkFreq ( const I3C_TypeDef * i3cx )

Return the peripheral clock frequency for I3C.

Parameters :

i3cx – I3C instance

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_I3C1_GetKernelClkFreq ( void )

Return the peripheral clock frequency for I3C1.

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_ADCDAC_GetKernelClkFreq ( void )

Return the peripheral clock frequency for ADCDAC.

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_DAC_GetKernelClkFreq ( const DAC_TypeDef * dacx )

Return the peripheral clock frequency for DAC.

Parameters :

dacx – DAC instance

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_ADC_GetKernelClkFreq ( const ADC_TypeDef * adcx )

Return the peripheral clock frequency for ADC.

Parameters :

adcx – ADC instance

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_DAC1_GetSampleHoldClkFreq ( void )

Return the peripheral clock frequency for DAC1 sample and hold.

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_LPTIM1_GetKernelClkFreq ( void )

Return the peripheral clock frequency for LPTIM1.

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_RTC_GetKernelClkFreq ( void )

Return the peripheral clock frequency for RTC.

Return values :
  • uint32_t – Frequency in Hz

  • 0 – Frequency not calculated (Oscillator not ready)

uint32_t HAL_RCC_GetSysTickExternalClkFreq ( void )

Get the Systick external clock frequency.

Return values :

uint32_t – Frequency in Hz

RCC privileged access levels attributes management

group RCC_Exported_Functions_Group5

This subsection provides a set of functions:

This subsection provides a set of functions:

Functions

hal_status_t HAL_RCC_SetPrivAttr ( uint32_t item , hal_rcc_priv_attr_t priv_attr )

Set the privileged access level attribute for item(s).

Parameters :
Return values :
  • HAL_OK – Privileged attribute has been set successfully

  • HAL_ERROR – Non-privileged write to a privileged-only register

hal_rcc_priv_attr_t HAL_RCC_GetPrivAttr ( uint32_t item )

Get the privileged access level attribute of an item.

Parameters :

item – This parameter can be one of the following values:

Return values :

The – returned value can be one of the following values: